package Boot;

import java.util.Scanner;

public class ApplicationBoot {
    private static Scanner scanner = new Scanner(System.in);

    public ApplicationBoot() {

    }

    //程序真正的启动入口
    public void run() {
        int i ;
        do {
            menu1();
            i = scanner.nextInt();
            //这里可以使用多线程分批处理多个用户请求，但是控制台多线程并不好演示
            switch (i){
                case 1:
                {
                    AdminApp adminApp = new AdminApp();
                    adminApp.run();
                    break;
                }
                case 2:
                {
                    UserApp userApp = new UserApp();
                    userApp.run();
                }
                case 3:
                    break;
                default:
                    System.out.println("输入错误请重新输入");
            }
        }while(i != 3);

    }

    private void menu1(){
        System.out.println("-----------------博客管理系统-------------");
        System.out.println("1.管理员用户登录");
        System.out.println("2.作者用户登录");
        System.out.println("3.退出");
        System.out.println("----------------------------------------");
    }
}
